import Vue from 'vue'
import Router from 'vue-router'
const originalPush = Router.prototype.push
Router.prototype.push = function push (location) {
  return originalPush.call(this, location).catch(err => err)
}

//首页
import login from '@/views/homepage/login.vue'
import homeIndex from '@/views/homepage/index.vue'
import company from "@/views/homepage/company.vue"

import index from '@/views/index.vue'
import addForm from '@/views/addForm/formComponent.vue'
import dataList from '@/views/addForm/dataList.vue'
//利润
import Manager from '@/views/profit/manager.vue'
//预算编制
import Budget from '@/views/budget/budget.vue'
import BudgetDetails from '@/views/budget/budgetDetails.vue'
import BudgetMonthDetails from '@/views/budget/budgetMonthDetails.vue'
import FileUpload from '@/views/budget/fileUpload.vue'
import grossProfitList from '@/views/budget/grossProfitList.vue'
import result from '@/views/budget/result.vue'

//收入
import profit from '@/views/grossProfit/profit.vue'
import profitDetails from '@/views/grossProfit/profitDetails.vue'
import monthlyDetails from "@/views/grossProfit/monthlyDetails"
import personalRanking from "@/views/grossProfit/personalRanking"

//费用
import costDetails from '@/views/cost/costDetails.vue'
import costDetails2 from '@/views/cost/costDetails2.vue'

import cost from '@/views/cost/cost.vue'
//导航条
import nav1 from '@/views/nav/nav1.vue'
import nav2 from '@/views/nav/nav2.vue'
import nav3 from '@/views/nav/nav3.vue'
import nav4 from '@/views/nav/nav4.vue'
import nav5 from '@/views/nav/nav5.vue'
import nav6 from '@/views/nav/nav6.vue'
import nav7 from '@/views/nav/nav7.vue'

import navCompo from '@/views/nav/navCompo.vue'




Vue.use(Router)

export default new Router({
  routes: [
    {
      path:'/',
      redirect :'/login'
    },
    {
      path:'/login',
      component: login
    },
    {
      path:'/company',
      component: company
    },
    {
      path:'/homeIndex',
      component: homeIndex,
      children:[
        {
          path:'/',
          redirect :'/index'
        },
        {
          path:'/index',
          component: index,
          meta: {
            KeepAlive: true
          }
        },
        {
          path:'/budget',
          component: Budget,
          meta: {
            KeepAlive: true
          }
        },
        {
          path: "/BudgetDetails/:type/:type2",
          component: BudgetDetails,
          meta: {
            KeepAlive: false
          }
        },
        {
          path: "/BudgetMonthDetails/:type/:type2",
          component: BudgetMonthDetails,
          meta: {
            KeepAlive: false
          }
        },
        {
          path: '/grossProfitList/:type',
          component: grossProfitList,
          meta: {
            KeepAlive: true
          }
        },
        {
          path:'/file',
          component: FileUpload,
          meta: {
            KeepAlive: false
          }
        },
        {
          path: '/result/:type/:type2',
          component: result,
        },
        {
          path:'/Manager',
          component: Manager,
          meta: {
            KeepAlive: true
          }
        },
        {
          path:'/addForm',
          component: addForm,
          meta: {
            KeepAlive: true
          }
        },
        {
          path:'/dataList',
          component: dataList,
          meta: {
            KeepAlive: false
          }
        },
        {
          path:'/nav1',
          component: nav1,
          meta: {
            KeepAlive: true
          }
        },
        {
          path:'/nav2',
          component: nav2,
          meta: {
            KeepAlive: true
          }
        },
        {
          path:'/nav3',
          component: nav3,
        },
        {
          path:'/nav4',
          component: nav4,
        },
        {
          path:'/nav5',
          component: nav5,
          meta: {
            KeepAlive: false
          }
        },
        {
          path:'/nav6/:yearOrMonth/:type',
          component: nav6,
          meta: {
            KeepAlive: false
          }
        },
        {
          path:'/nav7',
          component: nav7,
        },
        {
          path:'/navCompo/:modules',
          component: navCompo,
        },
        {
          path:'/profit',
          component: profit,
          meta: {
            KeepAlive: true
          }
        },
        {
          path: '/cost',
          component: cost,
          meta: {
            KeepAlive: true
          }
        },
        {
          path:'/costDetails',
          component: costDetails,
          meta: {
            KeepAlive: false
          }
        },
        {
          path:'/costDetails2',
          component: costDetails2,
          meta: {
            KeepAlive: false
          }
        },
        {
          path:'/profitDetails',
          component: profitDetails,
          meta: {
            KeepAlive: false
          }
        },
        {
          path:'/monthlyDetails',
          component: monthlyDetails,
          meta: {
            KeepAlive: false
          }
        },
        {
          path:'/personalRanking',
          component: personalRanking
        }
      ]
    }
  ]
})
